package com.itheima.controller;
import com.itheima.config.SpringConfig;
import com.itheima.domain.UserInfo;
import com.itheima.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;/**
 * @param
 * @return
 */
//更改运行入口
@RunWith(SpringJUnit4ClassRunner.class)
//指定加载的核心配置文件或者配置类
@ContextConfiguration(classes = {SpringConfig.class})
public class UserController {
  /*  public static void main(String[] args) {
       // ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("spring2.xml");
        AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(SpringConfig.class);
        UserService userService = ac.getBean(UserService.class);
        List<UserInfo> list = userService.findAll();
        System.out.println("list = " + list);
    }*/
  @Autowired
    private UserService userService;
  @Test
    public void Test1(){
      List<UserInfo> all = userService.findAll();
      System.out.println("all = " + all);
  }
}
